<!--#include file="../../inc/AspCms_SettingClass.asp" -->
<%
CheckAdmin("AspCms_FileManger.asp")
dim action : action=getForm("action","get")

Select  case action
	case "delallfile" : delAllFile
End Select 

dim dirpath,parentPath,countnum
countnum=1

dirpath=getForm("dirpath","get")

Sub uplpadFileList
dim path,fileListArray,i,fileAttr,folderListArray,folderAttr
	path = sitePath&"/upLoad"	
	if not isExistFolder(path) then createFolder path,"folderdir"
	if not isnul(getForm("dirpath","get")) then
		path=getForm("dirpath","get")
		parentPath=Mid(getForm("dirpath","get"),1,InstrRev(getForm("dirpath","get"),"/")-1)
	end if
	
	if ( not instr(path,"upLoad")>0 ) or instr(path,"..")>0 then	
		echo "<tr><td colspan='7' class='no-data'>你无权限访问些目录<a href='javascript:history.go(-1)'>返回</a></td></tr>"
		response.end
	end if
	
	if not isExistFolder(path) then	
		echo "<tr><td colspan='7' class='no-data'>没有这个目录<a href='javascript:history.go(-1)'>返回</a></td></tr>"
		response.end
	end if
	folderListArray=getFolderList(path)
	if instr(folderListArray(0),",")>0 then
		for i=0 to ubound(folderListArray)
			folderAttr=split(folderListArray(i),",")
			 echo "<tr>"&vbcrlf& _
			"<td class='input'><div class='label-box'><label for='Num"&i+1&"' class='uk-clearfix uk-float-left tm-transition'><span class='uk-float-left check check-select'><i class='tm-transition icon' uk-icon='icon: check'></i></span><input id='Num"&i+1&"' class='select' type='checkbox' name='path' value='"&folderAttr(4)&"'></label></div></td>"&vbcrlf& _
			"<td>"&i+1&"</td>"&vbcrlf& _
			"<td><a href='?dirpath="&folderAttr(4)&"'>"&folderAttr(0)&"</a></td>"&vbcrlf& _
			"<td>"&folderAttr(2)&"</td>"&vbcrlf& _
			"<td>"&folderAttr(1)&"</td>"&vbcrlf& _
			"<td>"&FormatDate(folderAttr(3), "yy-m-d h:mi:s")&"</td>"&vbcrlf& _
			"<td class='uk-flex uk-flex-center uk-text-center control'><ul class='uk-clearfix'><li class='uk-float-left'><a href='?action=delallfile&path="&folderAttr(4)&"' onClick=""return confirm('确定要删除吗')"">删除</a></li></ul></td>"&vbcrlf& _
			"</tr>"&vbcrlf
		next
	end if	
	
	fileListArray= getFileList(path)
	if instr(fileListArray(0),",")>0 then	
		for  i = 0 to ubound(fileListArray)
			fileAttr=split(fileListArray(i),",")
			 echo "<tr>"&vbcrlf& _
			"<td class='input'><div class='label-box'><label for='Num"&i+1&"' class='uk-clearfix uk-float-left tm-transition'><span class='uk-float-left check check-select'><i class='tm-transition icon' uk-icon='icon: check'></i></span><input id='Num"&i+1&"' class='select' type='checkbox' name='path' value='"&fileAttr(4)&"'></label></div></td>"&vbcrlf& _
			"<td>"&i+1&"</td>"&vbcrlf& _
			"<td><a target='_blank' href='"&fileAttr(4)&"'>"&fileAttr(0)&"</a></td>"&vbcrlf& _
			"<td>"&fileAttr(2)&"</td>"&vbcrlf& _
			"<td>"&fileAttr(1)&"</td>"&vbcrlf& _
			"<td>"&FormatDate(fileAttr(3), "yy-m-d h:mi:s")&"</td>"&vbcrlf& _
			"<td class='uk-flex uk-flex-center uk-text-center control'><ul class='uk-clearfix'><li class='uk-float-left'><a href='?action=delallfile&path="&fileAttr(4)&"&dirpath="&dirpath&"' onClick=""return confirm('确定要删除吗')"">删除</a></li></ul></td>"&vbcrlf& _
			"</tr>"&vbcrlf
		next		
	end if
	
	if not instr(folderListArray(0),",")>0  and not instr(fileListArray(0),",")>0 then
		echo "<tr><td colspan='7' class='no-data'>空文件夹<a href=""javascript:history.go(-1)"" class=""txt_C1"">返回</a></td></tr>"
	end if
End Sub

Sub delAllFile
	dim ids,idsArray,arrayLen,i
	ids=replace(getForm("path","both")," ","")
	idsArray = split(ids,",") : arrayLen=ubound(idsArray)
	for i=0 to arrayLen
		if isExistFolder(idsArray(i))then delFolder idsArray(i)
		if isExistFile(idsArray(i))then delFile idsArray(i)	
	next
	dirpath =getForm("dirpath","both")
	alertMsgAndGo "删除成功",getPageName()&"?dirpath="&dirpath
End Sub


Function getAllFileList(path,countnum)
	dim fileListArray,i,fileAttr,folderListArray,folderAttr,parentPath
	if not isExistFolder(path) then createFolder path,"folderdir"	
	
	if not instr(path,"upLoad")>0 then	
		echo "<tr><td colspan='7' class='no-data'>你无限访问些目录<a href=""javascript:history.go(-1)"" class=""txt_C1"">返回</a></td></tr>"
		response.end
	end if

	if not isExistFolder(path) then	
		echo "<tr><td colspan='7' class='no-data'>没有这个目录<a href=""javascript:history.go(-1)"" class=""txt_C1"">返回</a></td></tr>"
		response.end
	end if
	folderListArray=getFolderList(path)
	if instr(folderListArray(0),",")>0 then
		for i=0 to ubound(folderListArray)
			folderAttr=split(folderListArray(i),",")	
			if isExistFolder(folderAttr(4)) then
				getAllFileList folderAttr(4),countnum
			end if
		next
	end if	
	
	dim rsObj,rsObj1 ,rsObj2,rsObj3,rsObj4,rsObj5
	fileListArray= getFileList(path)
	if instr(fileListArray(0),",")>0 then	
		for  i = 0 to ubound(fileListArray)
			fileAttr=split(fileListArray(i),",")
			dim finame
			finame=replace(fileAttr(4),sitePath,"")
			Set rsObj=Conn.Exec("select count(*) from {prefix}Content where IndexImage like '%"&finame&"%' or ImagePath like '%"&finame&"%' or DownURL like '%"&finame&"%' or Content like '%"&finame&"%' or ContentSource like '%"&finame&"%' ","r1")'By XingMeng修改
			Set rsObj1=Conn.Exec("select count(*) from {prefix}Links where ImageURL like '%"&finame&"%' ","r1")
			Set rsObj2=Conn.Exec("select count(*) from {prefix}Language where SiteLogoUrl like '%"&finame&"%' ","r1")
			Set rsObj3=Conn.Exec("select count(*) from {prefix}Adv where AdvImg like '%"&finame&"%' ","r1")
			Set rsObj4=Conn.Exec("select count(*) from {prefix}Sort where SortContent like '%"&finame&"%' or ImagePath like '%"&finame&"%' or IndexImage like '%"&finame&"%' or IcoImage like '%"&finame&"%' or  IcoPath like '%"&finame&"%'  ","r1")  'By XingMeng修改
			Set rsObj5=Conn.Exec("select count(*) from {prefix}Labels where LabelContent like '%"&finame&"%' ","r1") 'By XingMeng添加

			if not rsObj(0)>0 and not rsObj1(0)>0 and not rsObj2(0)>0 and not rsObj3(0)>0 and not rsObj4(0)>0  and not rsObj5(0)>0 and not instr(lcase(slideImgs),lcase(finame))>0 and not instr(lcase(slideImgsB),lcase(finame))>0 and not instr(lcase(slideImgsC),lcase(finame))>0 and not instr(lcase(slideImgsD),lcase(finame))>0 then
			 echo "<tr>"&vbcrlf& _
				"<td class='input'><div class='label-box'><label for='Num"&i+1&"' class='uk-clearfix uk-float-left tm-transition'><span class='uk-float-left check check-select'><i class='tm-transition icon' uk-icon='icon: check'></i></span><input id='Num"&i+1&"' class='select' type='checkbox' name='path' value='"&fileAttr(4)&"'></label></div></td>"&vbcrlf& _
				"<td height=""28"">"&countnum&"</td>"&vbcrlf& _
				"<td><a target='_blank' href='"&fileAttr(4)&"'>"&fileAttr(0)&"</a></td>"&vbcrlf& _
				"<td>"&fileAttr(2)&"</td>"&vbcrlf& _
				"<td>"&fileAttr(1)&"</td>"&vbcrlf& _
				"<td>"&FormatDate(fileAttr(3), "yy-m-d h:mi:s")&"</td>"&vbcrlf& _
				"<td class='uk-flex uk-flex-center uk-text-center control'><ul class='uk-clearfix'><li class='uk-float-left'><a href='?action=delallfile&path="&fileAttr(4)&"' onClick=""return confirm('确定要删除吗')"">删除</a></li></ul></td>"&vbcrlf& _
				"</tr>"&vbcrlf
				countnum=countnum+1
				'if countnum>99 then exit Function
			end if
		next		
		rsObj.close :set rsObj=nothing
		rsObj1.close :set rsObj1=nothing
		rsObj2.close :set rsObj2=nothing
		rsObj4.close :set rsObj4=nothing
	end if
End Function
%>
